package com.luoqiz.demo.stringDemo;

import java.io.UnsupportedEncodingException;

import org.junit.Test;

public class StringDome {
	public static void main(String[] args) throws UnsupportedEncodingException {

		String s1="123";
		String s2="123";
		String s3=new String("444");
		String s4=new String("444");
		System.out.println(s1==s2);//true
		System.out.println(s3==s4);//false
		System.out.println(s3.equals(s4));//true
		
		String str = "a我是b";
		byte[] bytes = str.getBytes("utf-8");
		for (int b : bytes) {
			System.out.print("  " + b);
		}
		System.out.println("------------------");
		String s = new String(bytes, "utf-8");
		System.out.println(s);
	}

	@Test
	public static void test1() {
		int col = 0;
		for (int i = 0; i <= 0xffff; i++) {
			System.out.print(Integer.toHexString(i) + ":" + (char) i + "   ");
			col++;
			if (col > 20) {
				col = 0;
				System.out.println();
			}
		}
	}
}
